// src/api/auth/index.ts
import request from '@/utils/request';
import type { LoginData, LoginResult,CaptchaResult } from './types';

// 获取验证码接口
export function captcha(){
    return request<any,CaptchaResult>({
      url:'/api/v1/auth/captcha',
      method:'get',
      headers:{
        "Content-Type":"application/x-www-form-urlencoded"
      }
    })
} 

// 获取登录接口
export function loginApi(data:LoginData){
    const formData = new FormData()
    formData.append("username",data.username) // 用户名
    formData.append("password",data.password) // 密码
    formData.append("captchaKey",data.captchaKey||"")  //验证码key
    formData.append("captchaCode",data.captchaCode||"") // 验证码输入值
    return request({'url': "/api/v1/auth/login",
        method: "post",
        data: formData,
        headers: {
        "Content-Type": "application/x-www-form-urlencoded",
        },})
}


// 注销API

